<?php
/**
 * Created by PhpStorm.
 * User: Eric
 * Date: 2021/10/16
 * Time: 13:45
 */

namespace app\validate;
use app\exception\HttpExceptions;
use think\Validate;

class BaseValidate extends Validate
{
    protected function isNotEmpty($value, $rule, $data=[])
    {
        if(empty($value))
            return false;
        return true;
    }

    public function checkParam($data)
    {
        try {
            $this->check($data,$this->rule);
            if(!$this->check($data,$this->rule)){
                $msg = $this->getError();
                throw new HttpExceptions($msg,400);
            }
        } catch (ValidateException $e) {
            throw new HttpExceptions( $e->getMessage());
        }

    }
}